<form action="${CONTEXT_PATH}/m/dict/update" method="post" id="dict_update" class="form-horizontal">
    <input type="hidden" name="m.uuid" value="${m.uuid}"/>
<#include "/WEB-INF/template/page/admin/system/dict/_form.ftl"/>
</form>
<script type="text/javascript">
    jQuery("#dict_update").ready(function () {
        /*  KEY add readonly property    */
        $(this).find("[name='m.name']").attr("readonly", "true");
        $(this).find("#liveflag").val("${m.liveflag!}");

        // 定义验证参数
        var validateOptions = $.extend(CONST_VALIDATE.OPTION, {
            rules: {
                "m.type": {
                    required: true,
                    maxlength: 45
                },
                "m.name": {
                    required: true,
                    maxlength: 45
                },
                "m.value": {
                    required: true,
                    maxlength: 200
                }
            },
            messages: {
                "m.type": {
                    required: "<i class='fa fa-exclamation tooltips'></i>请输入类别",
                    maxlength: $.validator.format("<i class='fa fa-exclamation tooltips'></i>类别不能大于{0}个字符")
                },
                "m.name": {
                    required: "<i class='fa fa-exclamation tooltips'></i>请输入KEY",
                    maxlength: $.validator.format("<i class='fa fa-exclamation tooltips'></i>KEY不能大于{0}个字符")
                },
                "m.value": {
                    required: "<i class='fa fa-exclamation tooltips'></i>请输入值",
                    maxlength: $.validator.format("<i class='fa fa-exclamation tooltips'></i>值不能大于{0}个字符")
                }
            },
            submitHandler:function(form) {
                var modal = $("#ajax_update");
                $(form).ajaxSubmit(function (data, status, xhr) {
                    if (data.status) {
                        toastr.success(data.msg, '操作提示');
                    } else {
                        toastr.error(data.msg, '操作提示');
                    }
                });
                $(modal).modal('hide');
            }
        });
        //表单验证
        var validator = $("#dict_update").validate(validateOptions);
    });
</script>